/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.hiof.moraa.server.service.model;

import java.util.Comparator;

/**
 *
 * @author Bergy
 */
public class FeedTimeStampComparator implements Comparator<Feed> {

    private boolean isReverse = false;

    public void setIsReverse(boolean isReverse) {
        this.isReverse = isReverse;
    }

    @Override
    public int compare(Feed feed1, Feed feed2) {
        if (isReverse) {
            return feed2.getTimestamp().compareTo(feed1.getTimestamp());
        } else {
            return feed1.getTimestamp().compareTo(feed2.getTimestamp());
        }
    }
}
